package com.emex.app.web;

import com.emex.app.shared.data.Cost;
import com.emex.app.shared.data.CostExample;
import com.emex.app.shared.data.CostType;
import com.emex.app.shared.data.PlanFact;
import com.emex.app.shared.ws.CostWebService;
import com.emex.app.web.service.CostService;
import com.emex.app.web.service.CostTypeService;
import com.emex.app.web.service.PlanFactService;
import java.util.Date;
import java.util.List;
import javax.ejb.Stateless;
import javax.jws.WebService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;

/**
 *
 * @author Sergey Karavaev
 */
@WebService(serviceName = "CostWS", portName = "CostWSPort", targetNamespace = "http://emex.com/Cost")
@Stateless(name = "CostWS")
public class CostWS extends SpringBeanAutowiringSupport implements CostWebService {

    @Autowired
    private CostService costService;
    
    @Autowired
    private CostTypeService costTypeService;
    
    @Autowired
    private PlanFactService planFactService;

    @Override
    public int deleteCostByPrimaryKey(Integer id) {
        return costService.deleteCostByPrimaryKey(id);
    }

    @Override
    public Cost insertCost(Cost record) {
        return costService.insertCost(record);
    }

    @Override
    public List<Cost> selectCostByExample(CostExample costExample) {
        return costService.selectCostByExample(costExample);
    }

    @Override
    public Cost selectCostByPrimaryKey(Integer id) {
        return costService.selectCostByPrimaryKey(id);
    }

    @Override
    public Cost updateCostByPrimaryKey(Cost record) {
        return costService.updateCostByPrimaryKey(record);
    }

    @Override
    public List<Cost> getAllCostsByDate(Date date) {
        return costService.getAllCostsByDate(date);
    }

    @Override
    public int deleteCostTypeByPrimaryKey(Integer id) {
        return costTypeService.deleteCostTypeByPrimaryKey(id);
    }

    @Override
    public CostType insertCostType(CostType record) {
        return costTypeService.insertCostType(record);
    }

    @Override
    public List<CostType> getAllCostTypes() {
        return costTypeService.getAllCostTypes();
    }

    @Override
    public CostType updateCostType(CostType record) {
        return costTypeService.updateCostType(record);
    }

    @Override
    public CostType selectCostTypeByPrimaryKey(Integer id) {
        return costTypeService.selectCostTypeByPrimaryKey(id);
    }

    @Override
    public List<Cost> getAllCostsByDateAndCostType(Date startDate, Date endDate, Integer costTypeId) {
        return costService.getAllCostsByDateAndCostType(startDate, endDate, costTypeId);
    }

    @Override
    public List<Cost> getAllCostsByDateEqualOrGrater(Date date) {
        return costService.getAllCostsByDateEqualOrGrater(date);
    }

    @Override
    public PlanFact insertPlanFact(PlanFact record) {
        return planFactService.insertPlanFact(record);
    }

    @Override
    public PlanFact updatePlanFact(PlanFact record) {
        return planFactService.updatePlanFact(record);
    }

    @Override
    public PlanFact getCurrentMonthPlanFact() {
        return planFactService.getCurrentMonthPlanFact();
    }
}
